package interpreter

import (
	"parse/src/token"
)

type Context struct {
	SymbolTable    *SymbolTable
	DisplayName    string
	Parent         *Context
	ParentEntryPos *token.Position
}

// 实例化
func NewContext(displayName string, parent *Context, parentEntryPos *token.Position) *Context {
	temp := &Context{}
	temp.InitContext(displayName, parent, parentEntryPos)
	return temp
}

// 初始化
func (c *Context) InitContext(displayName string, parent *Context, parentEntryPos *token.Position) {
	c.DisplayName = displayName
	c.Parent = parent
	c.ParentEntryPos = parentEntryPos
	c.SymbolTable = nil
}
